package com.echo.im.mq.event.model;


import com.echo.im.common.model.IMRecvInfo;
import com.echo.im.common.vo.message.SystemMessageVO;
import com.echo.im.mq.contant.QueueConstants;
import com.echo.im.mq.event.BaseEvent;
import org.apache.commons.lang3.RandomStringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * @author Fuzhengwei bugstack.cn @小傅哥
 * @description 活动sku库存清空消息
 * @create 2024-03-30 12:43
 */
@Component
public class SystemPushMessageEvent extends BaseEvent<IMRecvInfo<SystemMessageVO>> {

    @Value(QueueConstants.OFFLINE_PRIVATE_TOPIC)
    private String topic;

    @Override
    public EventMessage<IMRecvInfo<SystemMessageVO>> buildEventMessage(IMRecvInfo<SystemMessageVO> recvInfo) {
        return EventMessage.<IMRecvInfo<SystemMessageVO>>builder()
                .id(RandomStringUtils.randomNumeric(11))
                .timestamp(new Date())
                .data(recvInfo)
                .build();
    }

    @Override
    public String topic() {
        return topic;
    }

}
